﻿using System;
using Quartz;
using Spring.Scheduling.Quartz;
using System.Diagnostics;
using System.IO;
using System.ComponentModel;
using System.Net;
using Common.Logging;

namespace DotNetServiceLib.Core
{
    ///<summary>
    /// Interface for all tasks that can get executed by the service.
    /// Since tasks can differ greatly, I would prefer to use an abstract class (Task) instead of an interface.
    /// Nevertheless, right now all tasks must inherit from QuartzJobObject and can't inherit from another class.
    /// A solution I see would be to modify QuartzJobObject to be an interface but that would imply a rewrite of (some parts) of the Quartz library . 
    /// </summary>
    public interface ITask
    {
        ///<summary>
        /// Gets or sets the name of the daemon's task.
        ///<returns>Return a System.String containing the name of the daemon's task.</returns>
        /// </summary>
        string Name { get; set; }

        ///<summary>
        /// Gets or sets the target to be executed by the daemon.
        ///<returns>Return a System.String containing the name of the target.</returns>
        /// </summary>
        string Target { get; set; }

        ///<summary>
        /// Gets or sets the arguments used to execute the target.
        ///<returns>Return a System.String containing the arguments used to execute the target.</returns>
        /// </summary>
        string Arguments { get; set; }

        ///<summary>
        /// Gets or sets the name of the class. Only usefull for reflection. 
        ///<returns>Return a System.String containing the name of the class.</returns>
        /// </summary>
        string ClassName { get; set; }

        ///<summary>
        /// Gets or sets the name of the method. Only usefull for reflection. 
        ///<returns>Return a System.String containing the name of the method.</returns>
        /// </summary>
        string MethodName { get; set; }

        ///<summary>
        /// Enable or disable logging. Helpfull to verify if a task is running correctly or  
        /// to avoid unnecesary log. Since the task are executed repeatedly, log can become cumbersome.
        /// Log's mechanism could be controlled using the log4net configuration but I needed a way to control 
        /// every task created. Only the logs of type INFO are controlled.
        ///<returns>Return a System.Boolean containing the name of the class.</returns>
        /// </summary>
        bool LoggingIsEnabled { get; set; }
    }
}
